package com.hxzy.controller;

import com.hxzy.common.vo.R;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 产品
 *
 * @author tonneyyy
 */
@Log4j2
@RestController
public class UserController {

    @Value(value = "${server.port}")
    private String port;


    /**
     * 根据用户id查询数据
     * @param id
     * @return
     */
    @GetMapping(value = "/user/{id}")
    public R findById(@PathVariable(value = "id") Long id) throws InterruptedException {
        Map<String,Object> map=new HashMap<>();
        map.put("id",id);
        map.put("name","小张"+id);
        map.put("state",1);


        log.info("user_server-提供服务器应用程序端口是："+port);
        return R.okHasData(map);
    }
}
